package com.ruiya.staging.goods.locate.util;

import com.ruiya.staging.goods.locate.grpc.GetGoodsIdResponse;
import com.ruiya.staging.goods.locate.grpc.RpcStatus;
import io.grpc.stub.StreamObserver;

public class GrpcResponseUtils {

    public static void doGetGoodsIdError(StreamObserver<GetGoodsIdResponse> responseObserver, int code, String errMsg){
        RpcStatus rpcStatus = RpcStatus.newBuilder().setCode(code).setMemo(errMsg).build();
        GetGoodsIdResponse response = GetGoodsIdResponse.newBuilder()
                .setStatus(rpcStatus)
                .build();
        responseObserver.onNext(response);
        responseObserver.onCompleted();
    }

}
